import request from '@/utils/request';
import { stringify } from 'qs';

const mockURL = 'http://127.0.0.1:4523/m1/4124772-0-default';

export function getFieldConfig(params) {
  return request(`/new-common/quickQueryLabel/getByCode?${stringify(params)}`, {
    method: 'GET',
    // baseURL: mockURL,
  });
}

export function updateFieldConfig(params) {
  return request(`/new-common/quickQueryLabel/saveOrUpdate`, {
    method: 'POST',
    data: params,
    // baseURL: mockURL,
  });
}

export function deleteFieldConfig(params) {
  return request(`/new-common/quickQueryLabel/delete?${stringify(params)}`, {
    method: 'POST',
    data: params,
    // baseURL: mockURL,
  });
}

//快捷查询列表
export function getQuickSearchList(params) {
  return request(`/new-common/quickSearch/config/list?${stringify(params)}`);
}

//新增快捷查询
export function addQuickSearchOp(params) {
  return request(`/new-common/quickSearch/config/save`, {
    method: 'POST',
    data: params,
  });
}

//删除快捷查询
export function delQuickSearchOp(params) {
  return request(`/new-common/quickSearch/config/del?${stringify(params)}`);
}

//更新快捷查询顺序
export function updateSortOp(params) {
  return request(`/new-common/quickSearch/config/update`, {
    method: 'POST',
    data: params,
  });
}